package com.nd.test.controller;

import java.util.List;
import java.util.Date;

import model.po.RoleModel;
import com.nd.test.vo.RoleModelVo;
import com.nd.test.repository.RoleModelRepository;
import com.nd.test.service.RoleModelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**   
 * Create by apisdk 
 */
@RestController
@RequestMapping(value="/roleModel")
public class RoleModelController {
	@Autowired
	private RoleModelRepository roleModelRepository;

	@Autowired
	private RoleModelService roleModelService;

	/**
	* @description create model
	* @return
	*/
	@RequestMapping(value= "", method = RequestMethod.POST)
	public RoleModelVo createRoleModel(@RequestBody RoleModelVo roleModelVo) throws Exception {
		return roleModelService.createRoleModel(roleModelVo);
	}

	/**
	* @description get model through id
	* @return
	*/
	@RequestMapping(value= "/{id}", method = RequestMethod.GET)
	public RoleModelVo getRoleModelById(@PathVariable String id){
		return roleModelService.getRoleModelById(id);
	}

	/**
	* @description update model through id
	* @return
	*/
	@RequestMapping(value= "/{id}", method = RequestMethod.PUT)
	public RoleModelVo updateRoleModelById(@PathVariable String id,@RequestBody RoleModelVo roleModelVo){
		return roleModelService.updateRoleModelById(id,roleModelVo);
	}

	/**
	* @description delete model through id
	* @return
	*/
	@RequestMapping(value= "/{id}", method = RequestMethod.DELETE)
	public void deleteRoleModelById(@PathVariable String id){
		roleModelService.deleteRoleModelById(id);
		return;
	}

}
